var StatusLine = function() { 
		/* Private members */
		this._statusMessage = "";
		this._statusMessageNode = null;
		this._statusMessageContainerNode = null;
		this._turnOffStatus = function() {			
							dojo.style(this._statusMessageContainerNode, {display:'none'})
						  };
						
		this._displayStatus = function() {			
							this._statusMessageNode.innerHTML = this._statusMessage;
							dojo.style(this._statusMessageContainerNode, {display:''})					
						  };
						

        /* public members */
		this.State = {	
				"TRANSIENT":0,  // Transient message
				"PERMANENT":1,  // Fixed message
	  			"RESET":2 // Turn off message
	  			};

		this.initialize =  function() {
						// Create new element here and make it invisible by default		
						this._statusMessageNode = document.createElement("div");
						this._statusMessageContainerNode = document.createElement("div");						
						
						this._statusMessageContainerNode.appendChild(this._statusMessageNode);
						dojo.place(this._statusMessageContainerNode, dojo.body(), "first");	
						
						dojo.style(this._statusMessageContainerNode, {
																position: 'absolute',
																left: '45%',
																top: '2px',
																height: '10px',
																display:'none'
															}
								  );
						dojo.style(this._statusMessageNode, {
														background: '#FFF1A8 none repeat scroll 0%',
														color: '#000',
														padding: '0pt 5px',
														fontFamily: 'Arial, Helvetica, sans-serif',
														fontSize: '14px',
														fontWeight: 'bold',
														textAlign: 'center',
														width: '100%'
													}
									);						
					};
					
		this.setStatusMessage = function(message, state) {			
			        var that = this;
			
					var timer = function() {
						that._statusMessage = "";
						that._turnOffStatus();
					}
					
					if (typeof state !== 'number') {
						state = this.State.TRANSIENT;
					}
					
					switch(state) {
						case this.State.TRANSIENT:
							this._statusMessage = message;
							setTimeout(timer, 5000);
							this._displayStatus();
							break;
						case this.State.PERMANENT:
							this._statusMessage = message;
							this._displayStatus();							
							break;
						case this.State.RESET:
							this._statusMessage = "";
							this._turnOffStatus();							
							break;
					}
				};	
};
	
dojo.addOnLoad(function() {
	statusLine = new StatusLine();
	statusLine.initialize();
});
				